package com.tanhua.server.interceptor;

import com.tanhua.domain.db.User;

/**
 * @author liuyp
 * @date 2021/01/26
 */
public class UserHolder {
    private static ThreadLocal<User> tl = new ThreadLocal<>();

    public static void setUser(User user) {
        tl.set(user);
    }

    public static User getUser(){
        return tl.get();
    }

    public static Long getUserId(){
        return tl.get().getId();
    }
}
